using Microsoft.AspNetCore.Mvc;
using MqttClient.Code;
using MqttService.Code;

namespace MqttClient.Controllers
{
    [ApiController]
    [Route("[controller]/[action]")]
    public class DemoController : ControllerBase
    { 
        private readonly ILogger<DemoController> _logger;
        private readonly IMqttManager _mqttManager;

        public DemoController(ILogger<DemoController> logger, IMqttManager mqttManager)
        {
            _logger = logger;
            _mqttManager = mqttManager;
        }

        [HttpGet]
        public bool Get(string topic, string data)
        {
            _mqttManager.PublishData(topic, data);
            return true;
        }
    }
}